package bb.lanxing.model.page;

public class PageInfo {
    private static final int DEFAULT_PAGE_SIZE = 20;
    private final int pageNum;
    private int page = 1;

    public PageInfo(int pageNum) {
        this.pageNum = pageNum;
    }

    public PageInfo() {
        this.pageNum = DEFAULT_PAGE_SIZE;
    }

    public void nextPage() {
        page++;
    }

    public void reset() {
        page = 1;
    }

    public boolean isFirstPage() {
        return page == 1;
    }

    public int getPage() {
        return page;
    }

    public boolean isLastPage(int count) {
        if (count < pageNum) {
            return true;
        } else {
            nextPage();
            return false;
        }
    }

    public int getPageSize() {
        return pageNum;
    }
}